/**
 * Created by 鹏 on 14-3-11.
 */
var projectService = require('../Service/projectService.js');
var teamService = require('../Service/teamService.js');

exports.desktop = function (req, res) {
    projectService.myProjects(req.session.User.UserId, function (projects) {
        res.render('desktop', { Projects: projects });
    })
};

exports.create = function (req, res) {
    var ProjectName = req.param("ProjectName");
    projectService.create(ProjectName, req.session.User.UserId, function () {
        res.json({Result: "OK"});
    });
};

exports.dashboard = function (req, res) {
    var projectId = req.params.ProjectId;
    projectService.get(projectId, function (project) {
        teamService.memberInProject(projectId, function (memberList) {
            res.render('dashboard', {Project: project, MemberList: memberList});
        });
    });
};